<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
	</body>
	<script type="text/javascript">
		/* 
			小明家里有三个人，爸爸和妈妈，小明是男的，今年18岁，兴趣爱好是打篮球和读书，
			爸爸是软件程序员，妈妈是UI设计师，小明家在深圳南山有一套100平方的房子，户型是三房一厅，
			今年小明家刚买了一辆特斯拉Model3.
		 */

		let xiaoming = new Object();
		xiaoming.性别 = "男";
		xiaoming.年龄 = 18;
		xiaoming.兴趣 = "打篮球和读书";
		console.log("小明：", xiaoming);

		let taba = new Object();
		taba.职业 = "软件程序员";
		console.log("小明他爸：", taba);

		let tama = new Object();
		tama.职业 = "UI设计师";
		console.log("小明他妈：", tama);

		let jia = new Object();
		jia.大小 = "100平方";
		jia.户型 = "三室一厅";
		jia.地区 = "深圳南山";
		console.log("小明家的房子：", jia);

		let che = new Object();
		che.型号 = "特斯拉Model3";
		console.log("小明家的车子：", che);

		console.log("--------------------------利用new建立对象------------------------------");

		function jieshao(sex, age, hobby) {
			this.性别 = sex;
			this.年龄 = age;
			this.兴趣 = hobby;
		}
		let xiaoming2 = new jieshao("男", 18, "打篮球和读书")
		console.log("小明：", xiaoming2);

		function zhiye(job) {
			this.职业 = job
		}
		let taba2 = new zhiye("软件程序员")
		console.log("小明爸爸的职业：", taba2);

		let tama2 = new zhiye("UI设计师")
		console.log("小明妈妈的职业：", tama2);

		function jia2(size, type, position) {
			this.大小 = size;
			this.户型 = type;
			this.地区 = position;
		}
		let fang = new jia2("100平方", "三室一厅", "深圳南山")
		console.log("小明家的房子：", fang);

		function vehicle2(type) {
			this.型号 = type;
		}
		let che2 = new vehicle2("特斯拉Model3")
		console.log("小明家的车子：", che2);

		console.log("--------------------------利用函数建立对象------------------------------");

		let xiaoming3 = {
			性别: "男",
			年龄: 18,
			兴趣: "打篮球和读书"
		}
		console.log("小明：", xiaoming3);

		let taba3 = {
			职业: "软件程序员"
		}
		console.log("小明他爸：", taba3);

		let tama3 = {
			职业: "UI设计师"
		}
		console.log("小明他妈：", tama3);

		let jia3 = {
			大小: "100平米",
			户型: "三室一厅",
			地区: "深圳南山"
		}
		console.log("小明家的房：", jia3);

		let che3 = {
			车子: "特斯拉",
			型号: "Model3"
		}
		console.log("小明家的车：", che3);
		
		console.log("--------------------------利用字面量建立对象------------------------------")
	</script>
</html>
